﻿<?php
  @header("content-Type: text/html; charset=utf-8"); //语言强制
  
  $specialTitle = 'RSI指标上周强势股';
  
	require_once('head.php');
?>

<br/><br/>

<style>
#index {
	font-family: "宋体", Arial, Verdana, sans-serif, Helvetica;
	width: 80%;
	border-collapse: collapse;
}

#index td,#index th {
	font-size: 12px;
	border: 1px solid #98bf21;
	padding: 3px 7px 2px 7px;
}

#index th {
	font-size: 12px;
	text-align: center;
	padding-top: 5px;
	padding-bottom: 4px;
	background: url(../images/header_bei.gif);
	color: #000000;
}

#index tr.alt td {
	background-color: #ffffff;
	color: #000000;
}

#index tr.alt1 td {
	background-color: #f4f5eb;
	color: #000000;
}
</style>

<script type="text/javascript" language="javascript"
	src="js/jquery-1.5.min.js"></script>
<script type="text/javascript" language="javascript"
	src="js/jquery.table.js"></script>
	
<div style="margin: 0 auto; text-align: center">

<table id="index" align="center">
	<thead>
		<tr>
			<th class="js-OrderByNum">序号</th>
			<th class="js-OrderByDate">分析时间</th>
			<th class="js-OrderByCode">股票代码</th>
			<th class="js-OrderByName">股票名称</th>
			<th class="js-OrderByRSI">周线RSI</th>
			<th class="js-OrderByAnalysis">简析</th>
		</tr>
	</thead>
	<tbody>
	
<?php
  // Connect to the database 
  $dbc = mysqli_connect('localhost', 'root', 'k00l@1D;', 'gudahu')
    or die('Error connecting to MySQL server.');
	mysqli_set_charset($dbc, 'utf8');
  // Retrieve the score data from MySQL
  
  $query = "SELECT rwt.id, rwt.stock_code, s.name, rwt.rsi, rwt.analysis, rwt.created_date from rsi_week_toper rwt inner join stock s on rwt.stock_code = s.code order by rwt.id";
  $result = mysqli_query($dbc, $query)
    or die('Error querying database.');
  $seq = 0;
  $rowClass = 'alt';  

  while ($row = mysqli_fetch_array($result)) { 
		  if (($seq ++) % 2 == 0) {
		      $rowClass = 'alt'; 
		  } else {
		      $rowClass = 'alt1';
		  } 
		  echo "<tr class='".$rowClass."' style='display: table-row;'>";
		  echo "<td class='js-Num'>".$row['id']."</td>";
		  echo "<td class='js-Date'>".$row['created_date']."</td>";  
		  echo "<td class='js-Code'><a target='_blank' href='http://www.gudahu.com/topHolderDetail.php?code=".$row['stock_code']."'>".$row['stock_code']."</a></td>";  
		  echo "<td class='js-Name'>".$row['name']."</td>";  
		  echo "<td class='js-Rsi'>".$row['rsi']."</td>";  
		  echo "<td class='js-Analysis'>".$row['analysis']."</td>"; 
		  echo "</tr>"; 
  }
  mysqli_close($dbc);
?>
			
	</tbody>
</table>

<script language="javascript" type="text/javascript">
	var tableElement = $("#index");
	var currentPageSize = 100;
	if (tableElement != null) {
		tableElement.tablePaging({
			pageSize : currentPageSize,
			sorting : true,
			sortDirection : "asc",
			sortSelector : ".js-Num",
			sortType : "number"
		});
		$(".js-OrderByDate").click(function() {
			tableElement.tablePaging({
				pageSize : currentPageSize,
				sorting : true,
				sortSelector : ".js-Date",
				sortType : "date"
			});
		});
		$(".js-OrderByCode").click(function() {
			tableElement.tablePaging({
				pageSize : currentPageSize,
				sorting : true,
				sortSelector : ".js-Code",
				sortType : "string"
			});
		});
		$(".js-OrderByName").click(function() {
			tableElement.tablePaging({
				pageSize : currentPageSize,
				sorting : true,
				sortSelector : ".js-Name",
				sortType : "string"
			});
		});
		$(".js-OrderByRsi").click(function() {
			tableElement.tablePaging({
				pageSize : currentPageSize,
				sorting : true,
				sortDirection : 'desc',
				sortSelector : ".js-Rsi",
				sortType : "number"
			});
		});
		$(".js-OrderByAnalysis").click(function() {
			tableElement.tablePaging({
				pageSize : currentPageSize,
				sorting : true,
				sortSelector : ".js-Analysis",
				sortType : "string"
			});
		});
	}
</script>

</div>

<br/><br/>

<?php
	require_once('foot.php');
?>  